appModule.component('nSponsorshipInformation', {

  templateUrl: 'components/meeting-info/sponsorship-information/sponsorship-information.template.html',

  controller: [
    '$scope',
    function($scope) {

      $scope.regSponsor = {
        regVal : 'default',
        regSponsorList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '赞助企业不能为空'},
          {name: 'pattern', tips: '企业名称不能超过50个汉子'},
          {name: 'pass', tips: '√'}
        ]
      };
      $scope.regSponsorMoney = {
        regVal : 'default',
        regSponsorMoneyList: [
          {name: 'default', tips: ''},
          {name: 'required', tips: '赞助金额不能为空'},
          {name: 'pattern', tips: '赞助金额必须是正整数'},
          {name: 'pass', tips: '√'}
        ]
      };

      $scope.change = function(reg,err){
        for(var attr in err){
          if(err[attr] == true){
            $scope[reg].regVal = attr;
            return;
          }
        }
        $scope[reg].regVal = 'pass';
      };

      /*添加联系人*/
      let IDSponsor = document.getElementById('IDSponsor');
      let addSponsor = document.getElementById('addSponsor');
      $scope.addSponsor = function(){
        IDSponsor.style.display = 'block';
        addSponsor.style.display = 'none';
      };
      $scope.delSponsor = function(){
        IDSponsor.style.display = 'none';
        addSponsor.style.display = 'inline-block';
      }

    },
  ]

});
